package com.orhon.smartcampus.modules.systemctl.inputMapper;

import java.util.Map;

import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import com.alibaba.fastjson.JSON;
import com.orhon.smartcampus.basicComponents.ConvertHelper;
import com.orhon.smartcampus.modules.systemctl.gqlInputModel.GQLWidgetsInput;

@Mapper(uses = {
        ConvertHelper.class
})
public interface WidgetsInputMapper {


    WidgetsInputMapper MAPPER = Mappers.getMapper(WidgetsInputMapper.class);

    default GQLWidgetsInput mapInput(final Map map){
        String json = JSON.toJSONString(map);
        GQLWidgetsInput input = JSON.parseObject(json , GQLWidgetsInput.class);
        return input;
    }
}
